// index.js
Page({
  data:{
    msg:"hello world",
    url:"",
    nickName:"",
    code:"",
    result:""
  },
  getUserInfo:function(){
    //调用微信函数小程序库：获取用户信息
    wx.getUserProfile({
      desc: '获取用户信息',
      success: response=>{
        console.log(response)
        this.setData({
          url:response.userInfo.avatarUrl,
          nickName:response.userInfo.nickName
        })
      }
    })
  },
  wxLogin: function(){
    //调用微信登陆获取授权码函数
    wx.login({
      success: (res) => {
       console.log(res) ;
       this.setData({
         code:res.code
        })
       
      }
    })
    },
    getShopData:function(){
      //发送异步请求获取店铺状态
      wx.request({
        url: 'http://localhost:8080/user/shop/status',
        method:"GET",
        success:resp=>{
          console.log(resp)
          this.setData({
            result:resp.data
          })
        }
      })
    }
})
